#include <iostream>
#include <type_traits>
#include <string>
#include <iostream>

class A
{
    int m_a = 42;
public:
    A() {std::cout << "1"; }
    ~A() { std::cout << "2"; }
};
class B
{
    int m_b = 36;
public:
   B() {std::cout << "3";}
   ~B() { std::cout << "4"; }
   void DoB() { std::cout << "B"; }
};
void *operator new(size_t n, B* buf) { buf->DoB(); return buf; }
void operator delete(void* p, B* buf) { buf->DoB(); }

int main()
{
    B* pb = new B{};
    A* pa = new(pb)A{};
    pa->~A();
    // // delete pa;
    operator delete(pa,pb);
}